<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title></title>
	</head>
	<body>
	<script>
		var arr = [4,5,67,1,3,4,9,2];
		arr.sort(function(a,b){
			/* sort方法依靠匿名函数的逻辑从左到右两两比较数组元素
			,两者位置对调,所以return a-b得到的排序结果将是升序的,反之降序 */
			return a-b;
		});
		console.log(arr);
	</script>	
	</body>
</html>